﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace KWT.DRG_DIP.API.Migrations
{
    /// <inheritdoc />
    public partial class _20250429082630 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "List_Quota");

            migrationBuilder.DropColumn(
                name: "Coder",
                table: "Sys_List");

            migrationBuilder.DropColumn(
                name: "Doctor",
                table: "Sys_List");

            migrationBuilder.DropColumn(
                name: "FeeRemain",
                table: "Sys_List");

            migrationBuilder.DropColumn(
                name: "InDays",
                table: "Sys_List");

            migrationBuilder.DropColumn(
                name: "TotalFee",
                table: "Sys_List");

            migrationBuilder.AddColumn<decimal>(
                name: "Remain",
                table: "List_ChargeInfo",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m,
                comment: "结余");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Remain",
                table: "List_ChargeInfo");

            migrationBuilder.AddColumn<string>(
                name: "Coder",
                table: "Sys_List",
                type: "varchar(256)",
                maxLength: 256,
                nullable: false,
                defaultValue: "",
                comment: "编码员")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Doctor",
                table: "Sys_List",
                type: "varchar(256)",
                maxLength: 256,
                nullable: false,
                defaultValue: "",
                comment: "主治医生")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<decimal>(
                name: "FeeRemain",
                table: "Sys_List",
                type: "decimal(18,2)",
                precision: 2,
                nullable: false,
                defaultValue: 0m,
                comment: "费用结余");

            migrationBuilder.AddColumn<int>(
                name: "InDays",
                table: "Sys_List",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "住院天数");

            migrationBuilder.AddColumn<decimal>(
                name: "TotalFee",
                table: "Sys_List",
                type: "decimal(18,2)",
                precision: 2,
                nullable: false,
                defaultValue: 0m,
                comment: "医疗总费用");

            migrationBuilder.CreateTable(
                name: "List_Quota",
                columns: table => new
                {
                    LQID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BFL = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "拨付率"),
                    FL = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "费率"),
                    FYXHZS = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "费用消耗指数"),
                    GRFD = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "个人负担"),
                    HZB = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "耗占比"),
                    JY = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "结余"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    QZ = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "权重"),
                    SJXHZS = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "时间消耗指数"),
                    YZB = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "药占比")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_List_Quota", x => x.LQID);
                },
                comment: "清单-指标")
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
